package com.fwh.gmall.service.impl;

import com.fwh.gmall.dto.User;
import com.fwh.gmall.dao.UserDao;
import com.fwh.gmall.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {

//    private final UserDao userDao;
//
//    public UserServiceImpl(UserDao userDao) {
//        this.userDao = userDao;
//    }
    @Autowired
    UserDao userDao;

    @Override
    public User getUserById(Integer id) {
        return userDao.getUserByUserId(id);
    }

    @Override
    public List<User> listUser() {
        return userDao.getAllUsers();
    }

    @Override
    public int save(User user) {
        return userDao.Save(user);
    }

    @Override
    public int delete(Integer id) {
        return userDao.delete(id);
    }
}
